/*
 * Copyright (c) 2014 Red Hat, Inc. and others
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.weimai.message.gateway.entity;

import io.vertx.core.json.JsonObject;

/**
 * Converter for {@link GwUserAccess}.
 *
 * NOTE: This class has been automatically generated from the {@link GwUserAccess} original class using Vert.x codegen.
 */
public class GwUserAccessConverter {
    
    public static void fromJson(JsonObject json, GwUserAccess obj) {
        if (json.getValue("id") instanceof Number) {
            obj.setId(((Number)json.getValue("id")).longValue());
        }
        if (json.getValue("accountNo") instanceof String) {
            obj.setAccountNo((String)json.getValue("accountNo"));
        }
        if (json.getValue("accessKey") instanceof String) {
            obj.setAccessKey((String)json.getValue("accessKey"));
        }
        if (json.getValue("isDel") instanceof Integer) {
            obj.setIsDel(((Integer)json.getValue("isDel")));
        }
        if (json.getValue("accessSecret") instanceof String) {
            obj.setAccessSecret(((String)json.getValue("accessSecret")));
        }
    }
    
    public static void toJson(GwUserAccess obj, JsonObject json) {
        if (obj.getId() != null) {
            json.put("id", obj.getId());
        }
        if (obj.getAccountNo() != null) {
            json.put("accountNo", obj.getAccountNo());
        }
        if (obj.getAccessKey()!= null) {
            json.put("accessKey", obj.getAccessKey());
        }
        if (obj.getAccessSecret()!= null) {
            json.put("accessSecret", obj.getAccessSecret());
        }
        if (obj.getIsDel() != null) {
            json.put("isDel", obj.getIsDel());
        }
    }
}
